home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / ftsc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-05  |  21.9 KB  |  758 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                 This module was written by Bob Hartman                   */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*                 BinkleyTerm FTSC Mail Session Routines                   */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  27. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  28. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  29. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  30. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /*    The Authors can be reached at the following addresses:                */
  34. /*                                                                          */
  35. /*    Robert C. Hartman                      Vincent E. Perriello           */
  36. /*    Spark Software                         VEP Software                   */
  37. /*    427-3 Amherst Street                   111 Carroll Street             */
  38. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  39. /*    Nashua, NH 03061                                                      */
  40. /*                                                                          */
  41. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  42. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  43. /*                                                                          */
  44. /*    Please feel free to contact us at any time to share your comments     */
  45. /*    about our software and/or licensing policies.                         */
  46. /*                                                                          */
  47. /*--------------------------------------------------------------------------*/
  48.  
  49. #include <signal.h>
  50. #include <ctype.h>
  51. #include <conio.h>
  52. #include <time.h>
  53. #include <string.h>
  54. #include <io.h>
  55.  
  56. #ifdef __TURBOC__
  57. #include <alloc.h>
  58. #else
  59. #include <malloc.h>
  60. #endif
  61.  
  62. #define WAZOO_SECTION
  63. #define MATRIX_SECTION
  64.  
  65. #define isBITBRAIN 0x1b
  66.  
  67. #include "com.h"
  68. #include "xfer.h"
  69. #include "zmodem.h"
  70. #include "keybd.h"
  71. #include "sbuf.h"
  72. #include "sched.h"
  73. #include "externs.h"
  74. #include "prototyp.h"
  75. #include "find.h"   /*PLF Sat  05-06-1989  00:49:59 */
  76.  
  77. #define rb_plus "r+b"
  78.  
  79. static int FTSC_callback (char *);
  80. static int FTSC_sendmail (void);
  81. static int FTSC_recvmail (void);
  82.  
  83. #define NUM_FLAGS 4
  84.  
  85. void FTSC_sender (wz)
  86. int wz;
  87. {
  88.    int j;
  89.    char junkbuff[128];
  90.    long t1, timerset ();
  91.  
  92.    if (!wz)
  93.       {
  94.       status_line ("*Sending mail using FSC001 fallback");
  95.       who_is_he = 0;
  96.       sprintf (junkbuff, "*%s (%u/%u)",
  97.                newnodedes.SystemName,
  98.                remote_net,
  99.                remote_node);
  100.       status_line (junkbuff);
  101.       }
  102.  
  103.    Netmail_Session = 1;
  104.  
  105.    FTSC_sendmail ();
  106.    t1 = timerset (1000);
  107.  
  108.    /* See what the receiver would like us to do */
  109.    while ((!timeup (t1)) && CARRIER)
  110.       {
  111.       if ((j = PEEKBYTE ()) >= 0)
  112.          {
  113.          switch (j)
  114.             {
  115.             case TSYNC:
  116.                CLEAR_INBOUND ();
  117.                if (FTSC_recvmail ())
  118.                   goto get_out;
  119.                t1 = timerset (1000);
  120.                break;
  121.  
  122.             case SYN:
  123.                CLEAR_INBOUND ();
  124.                if (on_our_nickel)
  125.                   SEA_recvreq ();
  126.                else
  127.                   {
  128.                   SENDBYTE (CAN);
  129.                   status_line ("*Refusing inbound file requests");
  130.                   }
  131.                t1 = timerset (1000);
  132.                break;
  133.  
  134.             case ENQ:
  135.                CLEAR_INBOUND ();
  136.                SEA_sendreq ();
  137.                goto get_out;
  138.  
  139.             case NAK:
  140.             case 'C':
  141.                TIMED_READ (0);
  142.                TIMED_READ (1);
  143.                TIMED_READ (1);
  144.                SENDBYTE (EOT);
  145.                t1 = timerset (1000);
  146.                break;
  147.  
  148.             case SUB:
  149.                TIMED_READ (0);
  150.                SENDBYTE (CAN);
  151.                break;
  152.  
  153.             default:
  154.                TIMED_READ (0);
  155.                SENDBYTE (EOT);
  156.                break;
  157.             }
  158.          }
  159.       else
  160.          {
  161.          time_release ();
  162.          }
  163.       }
  164.  
  165.    if (!CARRIER)
  166.       {
  167.       status_line ("!Other end hung up on us <humph>.");
  168.       CLEAR_INBOUND ();
  169.       return;
  170.       }
  171.  
  172.    if (timeup (t1))
  173.       {
  174.       FTSC_recvmail ();
  175.       status_line ("!Tired of waiting for other end.");
  176.       }
  177.  
  178. get_out:
  179.    t1 = timerset (100);
  180.    while (!timeup (t1))
  181.       time_release ();
  182.    if (!wz)
  183.       status_line ("*End of FSC001 Session");
  184. }
  185.  
  186. int FTSC_receiver (wz)
  187. int wz;
  188. {
  189.    char fname[64];
  190.    int havemail, done, np;
  191.    unsigned int i, j;
  192.    long t1, t2, timerset ();
  193.    FSCAN *dh;   /*PLF Fri  05-05-1989  23:23:57 */
  194.    struct stat buf;
  195.    char *HoldName;
  196.  
  197.  
  198.    if (!wz)
  199.       {
  200.       status_line ("*Receiving mail using FSC001 fallback");
  201.       who_is_he = 1;
  202.       }
  203.  
  204.    Netmail_Session = 1;
  205.  
  206.    CLEAR_INBOUND ();
  207.  
  208.    /* Save the state of pickup for now */
  209.    done = no_pickup;
  210.    no_pickup = 0;
  211.    if (FTSC_recvmail ())
  212.       {
  213.       /* Restore the state of pickup */
  214.       no_pickup = done;
  215.       if (!wz)
  216.          status_line ("*End of FSC001 Session");
  217.       return (1);
  218.       }
  219.  
  220.    /* Restore the state of pickup */
  221.    no_pickup = done;
  222.  
  223.    remote_zone = called_zone;
  224.    remote_net = called_net;
  225.    remote_node = called_node;
  226.  
  227.  
  228.    HoldName = HoldAreaNameMunge(called_zone);
  229.  
  230.    /* Now see if we should send anything back to him */
  231.    sprintf (fname, "%s%04x%04x.?UT", HoldName, remote_net, remote_node);
  232.    dh = opendir();  /*PLF Fri  05-05-1989  23:24:21 */
  233.    havemail = findfirst(fname, _A_NORMAL, dh);  /*PLF Fri  05-05-1989  23:24:43 */
  234.  
  235.    if (havemail)
  236.       {
  237.       sprintf (fname, "%s%04x%04x.?LO", HoldName, remote_net, remote_node);
  238.       havemail = findfirst(fname, _A_NORMAL, dh);   /*PLF Fri  05-05-1989  23:26:49 */
  239.       }
  240.  
  241.    if (havemail)
  242.       {
  243.       for (np = 0; np <= ALIAS_CNT; np++)
  244.          {
  245.          if (alias[np].Net == 0)
  246.             break;
  247.          sprintf (fname, "%s%04x%04x.REQ", CurrentNetFiles, alias[np].Net, alias[np].Node);
  248.          if (!(havemail = findfirst(fname, _A_NORMAL, dh))) /*PLF Fri  05-05-1989  23:27:26 */
  249.             break;
  250.          }
  251.       }
  252.    closedir(dh);    /*PLF Fri  05-05-1989  23:29:21 */
  253.    if (havemail)
  254.       {
  255.       status_line ("*No mail waiting for %d:%d/%d", remote_zone, remote_net, remote_node);
  256.       }
  257.    else
  258.       {
  259.       status_line ("*Giving mail to %d:%d/%d", remote_zone, remote_net, remote_node);
  260.       /* Send the TSYNC's until we get a C or NAK or CAN back */
  261.       t1 = timerset (3000);                      /* set 30 second timeout */
  262.       j = 0xffff;
  263.       done = 0;
  264.       while (!timeup (t1) && CARRIER && !done)   /* till then or CD lost  */
  265.          {
  266.          SENDBYTE (TSYNC);
  267.  
  268.          t2 = timerset (300);
  269.          while (CARRIER && (!timeup (t2)) && !done)
  270.             {
  271.             i = (unsigned) TIMED_READ (0);
  272.  
  273.             switch (i)
  274.                {
  275.                case 'C':
  276.                case 0x00:
  277.                case 0x01:
  278.                   if (j == 'C')
  279.                      {
  280.                      done = 1;
  281.                      FTSC_sendmail ();
  282.                      }
  283.                   break;
  284.  
  285.                case 0xfe:
  286.                   if (j == 0x01)
  287.                      {
  288.                      done = 1;
  289.                      FTSC_sendmail ();
  290.                      }
  291.                   break;
  292.  
  293.                case 0xff:
  294.                   if (j == 0x00)
  295.                      {
  296.                      done = 1;
  297.                      FTSC_sendmail ();
  298.                      }
  299.                   else
  300.                      {
  301.                      time_release ();
  302.                      }
  303.                   break;
  304.  
  305.                case NAK:
  306.                   if (j == NAK)
  307.                      {
  308.                      done = 1;
  309.                      FTSC_sendmail ();
  310.                      }
  311.                   break;
  312.  
  313.                case CAN:
  314.                case ENQ:
  315.                case SYN:
  316.                   done = 1;
  317.                   status_line ("*Node %d:%d/%d refused to pickup mail", remote_zone, remote_net, remote_node);
  318.                   break;
  319.                }
  320.             if (i != 0xffff)
  321.                j = i;
  322.             }
  323.          }
  324.       }
  325.  
  326.    if (wz)
  327.       return TRUE;                      /* All done if this is WaZOO */
  328.  
  329.    /* Now see if we want to request anything */
  330.    sprintf (fname, "%s%04x%04x.REQ", HoldName, remote_net, remote_node);
  331.    if (!stat (fname, &buf))
  332.       {
  333.       /* Send the SYN character and wait for an ENQ or CAN */
  334.       t1 = timerset (3000);                      /* set 30 second timeout */
  335.       done = 0;
  336.       while (!timeup (t1) && CARRIER && !done)   /* till then or CD lost  */
  337.          {
  338.          SENDBYTE (SYN);
  339.  
  340.          t2 = timerset (300);
  341.          while (CARRIER && (!timeup (t2)) && !done)
  342.             {
  343.             i = TIMED_READ (0);
  344.  
  345.             switch (i)
  346.                {
  347.                case ENQ:
  348.                   SEA_sendreq ();
  349.  
  350.                case CAN:
  351.                   done = 1;
  352.                   break;
  353.  
  354.                case 'C':
  355.                case NAK:
  356.                   SENDBYTE (EOT);
  357.                   break;
  358.  
  359.                case SUB:
  360.                   SENDBYTE (CAN);
  361.                   break;
  362.  
  363.                default:
  364.                   time_release ();
  365.                }
  366.             }
  367.          }
  368.       }
  369.  
  370.    /* Finally, can he request anything from us */
  371.    if (!no_requests)
  372.       SEA_recvreq ();
  373.  
  374.    status_line ("*End of FSC001 Session");
  375.    return TRUE;
  376. }
  377.  
  378. static int FTSC_sendmail ()
  379. {
  380.    FILE *fp;
  381.    char fname[80];
  382.    char s[80];
  383.    char *sptr;
  384.    char *HoldName;
  385.    int c;
  386.    int j = 0;
  387.    struct stat buf;
  388.    struct _pkthdr *tmppkt;
  389.    long t1, time (), timerset ();
  390.    struct tm *tm1, *localtime ();
  391.  
  392.    sptr = s;
  393.    /*--------------------------------------------------------------------*/
  394.    /* Send all waiting ?UT files (mail packets)                          */
  395.    /*--------------------------------------------------------------------*/
  396.    *ext_flags = 'O';
  397.    HoldName = HoldAreaNameMunge(called_zone);
  398.    for (c = 0; c < NUM_FLAGS; c++)
  399.       {
  400. #ifndef JACK_DECKER
  401.       if (caller && (ext_flags[c] == 'H'))
  402.          continue;
  403. #endif
  404.  
  405.       sprintf (fname,
  406.                "%s%04x%04x.%cUT",
  407.                HoldName, called_net, called_node, ext_flags[c]);
  408.       errno = 0;
  409.  
  410.       if (!stat (fname, &buf))
  411.          break;
  412.       }                                          /* for */
  413.  
  414.    /*--- Build a dummy PKT file name */
  415.    invent_pkt_name (s);
  416.  
  417.    status_line (" Sending Mail Packet to %d:%d/%d", called_zone, called_net, called_node);
  418.  
  419.    if (c == NUM_FLAGS)
  420.       {
  421.       sprintf (fname,
  422.                "%s%04x%04x.OUT",
  423.                HoldName, called_net, called_node);
  424.       errno = 0;
  425.       fp = fopen (fname, "wb");
  426.       if (got_error (OPEN_msg, fname))
  427.          {
  428.          return (1);
  429.          }
  430.       errno = 0;
  431.       t1 = time (NULL);
  432.       tm1 = localtime (&t1);
  433.  
  434.       tmppkt = (struct _pkthdr *) calloc (sizeof (struct _pkthdr), 1);
  435.       if (tmppkt == NULL)
  436.          {
  437.          status_line ("!Mem err in sending");
  438.          fclose (fp);
  439.          return (1);
  440.          }
  441.       tmppkt->orig_node = alias[assumed].Node;
  442.       tmppkt->dest_node = called_node;
  443.       tmppkt->year = tm1->tm_year;
  444.       tmppkt->month = tm1->tm_mon;
  445.       tmppkt->day = tm1->tm_mday;
  446.       tmppkt->hour = tm1->tm_hour;
  447.       tmppkt->minute = tm1->tm_min;
  448.       tmppkt->second = tm1->tm_sec;
  449.       tmppkt->rate = 0;
  450.       tmppkt->ver = PKTVER;
  451.       tmppkt->orig_net = alias[assumed].Net;
  452.       tmppkt->dest_net = called_net;
  453.       tmppkt->product = isBITBRAIN;
  454.       if (n_getpassword (called_zone, called_net, called_node))
  455.          {
  456.          if (remote_password != NULL)
  457.             {
  458.             strncpy (tmppkt->password, remote_password, 6);
  459.             strupr (tmppkt->password);
  460.             }
  461.          }
  462.       tmppkt->orig_zone = alias[assumed].Zone;
  463.       tmppkt->dest_zone = called_zone;
  464.  
  465.       fwrite ((char *) tmppkt, sizeof (struct _pkthdr), 1, fp);
  466.       free (tmppkt);
  467.       if (got_error (WRITE_msg, fname))
  468.          {
  469.          fclose (fp);
  470.          return (1);
  471.          }
  472.       fwrite ("\0\0", 2, 1, fp);
  473.       fclose (fp);
  474.       }
  475.    else
  476.       {
  477.       errno = 0;
  478.       fp = fopen (fname, rb_plus);
  479.       if (got_error (OPEN_msg, fname))
  480.          {
  481.          return (1);
  482.          }
  483.       tmppkt = (struct _pkthdr *) calloc (sizeof (struct _pkthdr), 1);
  484.       if (tmppkt == NULL)
  485.          {
  486.          status_line ("!Mem err in sending");
  487.          return (1);
  488.          }
  489.       errno = 0;
  490.       fread (tmppkt, 1, sizeof (struct _pkthdr), fp);
  491.       if (got_error (READ_msg, fname))
  492.          {
  493.          free (tmppkt);
  494.          fclose (fp);
  495.          return (1);
  496.          }
  497.  
  498.       if (n_getpassword (called_zone, called_net, called_node))
  499.          {
  500.          if (remote_password != NULL)
  501.             {
  502.             strncpy (tmppkt->password, remote_password, 8);
  503.             }
  504.          }
  505.  
  506.  
  507.       /* Make sure the zone info is in there */
  508.  
  509.       tmppkt->orig_node = alias[assumed].Node;
  510.       tmppkt->orig_net  = alias[assumed].Net;
  511.       tmppkt->orig_zone = alias[assumed].Zone;
  512.       tmppkt->dest_zone = called_zone;
  513.  
  514.       errno = 0;
  515.       fseek (fp, 0L, SEEK_SET);
  516.       fwrite (tmppkt, 1, sizeof (struct _pkthdr), fp);
  517.       fclose (fp);
  518.       free (tmppkt);
  519.       }
  520.  
  521.    net_problems = send_file (fname, 'S');
  522.    if ((net_problems == TSYNC) || (net_problems == 0))
  523.       {
  524.       if (c == NUM_FLAGS)
  525.          unlink (fname);
  526.       return (net_problems);
  527.       }
  528.  
  529.    /* Delete the sent packet */
  530.    unlink (fname);
  531.  
  532.  
  533.    /*--------------------------------------------------------------------*/
  534.    /* Send files listed in ?LO files (attached files)                    */
  535.    /*--------------------------------------------------------------------*/
  536.    *ext_flags = 'F';
  537.    status_line (" Outbound file attaches");
  538.  
  539.    if (!do_FLOfile (ext_flags, FTSC_callback))
  540.       return FALSE;
  541.  
  542.  
  543.    /*--------------------------------------------------------------------*/
  544.    /* Send our File requests to other system if it's a WaZOO             */
  545.    /*--------------------------------------------------------------------*/
  546.  
  547.    if (requests_ok && remote_capabilities)
  548.       {
  549.       sprintf (fname, request_template, HoldName, called_net, called_node);
  550.       if (!stat (fname, &buf))
  551.          {
  552.          if (!(remote_capabilities & WZ_FREQ))
  553.             status_line ("*F.REQ. declined");
  554.          else
  555.             {
  556.             status_line ("*Making file request");
  557.             if (FTSC_callback (fname))
  558.                unlink (fname);
  559.             }
  560.          }
  561.       }
  562.  
  563.    /*--------------------------------------------------------------------*/
  564.    /* Process WaZOO file requests from other system                      */
  565.    /*--------------------------------------------------------------------*/
  566.  
  567.    j = respond_to_file_requests (j, FTSC_callback);
  568.  
  569.    /* Now close out the file attaches */
  570.    sent_mail = 1;
  571.    *sptr = 0;
  572.    status_line (" End of outbound file attaches");
  573.    t1 = timerset (100);
  574.    while (CARRIER && !timeup (t1))
  575.       {
  576.       j = TIMED_READ (0);
  577.       if ((j == 'C') || (j == NAK))
  578.          {
  579.          SENDBYTE (EOT);
  580.          t1 = timerset (100);
  581.          }
  582.       else
  583.          {
  584.          time_release ();
  585.          }
  586.       }
  587.    return TRUE;
  588. }
  589.  
  590. static int FTSC_recvmail ()
  591. {
  592.    char fname[80];
  593.    char fname1[80];
  594.    struct _pkthdr tmppkt;
  595.    FILE *fp;
  596.    char *s, *p;
  597.    char done;
  598.    int i;
  599.    int j;
  600.    extern char *receive_file ();
  601.  
  602.    status_line ("*Receiving inbound mail");
  603.  
  604.    if (!CARRIER)
  605.       {
  606.       status_line ("!Other end hung up on us <humph>.");
  607.       CLEAR_INBOUND ();
  608.       return (1);
  609.       }
  610.  
  611.    /* If we don't want to pickup stuff */
  612.    if (no_pickup)
  613.       {
  614.       status_line ("*Pickup is turned off - refusing mail.");
  615.       SENDBYTE (CAN);
  616.       }
  617.    else
  618.       {
  619.       status_line (" Inbound Mail Packet");
  620.       /* Invent a dummy name for the packet */
  621.       invent_pkt_name (fname);
  622.  
  623.       /* Receive the packet with special netmail protocol */
  624.       CLEAR_INBOUND ();
  625.       SENDBYTE ('C');
  626.       SENDBYTE (0x01);
  627.       SENDBYTE (0xfe);
  628.       if ((s = receive_file ((p = CurrentNetFiles), fname, 'B')) != NULL)
  629.          {
  630.          got_packet = 1;
  631.          }
  632.  
  633.       /* Check the password if there is one */
  634.       if ((!remote_capabilities) && (n_getpassword (remote_zone, remote_net, remote_node)))
  635.          {
  636.          if (remote_password != NULL)
  637.             {
  638.             got_packet = 0;
  639.             errno = 0;
  640.             sprintf (fname, "%s%s", p, s);
  641.             fp = fopen (fname, rb_plus);
  642.             if (got_error (OPEN_msg, fname))
  643.                {
  644.                status_line ("!Password Error assumed");
  645.                return (1);
  646.                }
  647.             errno = 0;
  648.             fread (&tmppkt, 1, sizeof (struct _pkthdr), fp);
  649.             if (got_error (OPEN_msg, fname))
  650.                {
  651.                status_line ("!Password Error assumed");
  652.                fclose (fp);
  653.                return (1);
  654.                }
  655.             fclose (fp);
  656.             remote_password[7] = '\0';
  657.             tmppkt.password[7] = '\0';
  658.             if (stricmp (remote_password, tmppkt.password))
  659.                {
  660.                status_line ("!Password Error: expected '%s' got '%s'",
  661.                             remote_password, tmppkt.password);
  662.                strcpy (fname1, fname);
  663.                j = strlen (fname) - 3;
  664.                strcpy (&(fname[j]), "Bad");
  665.                if (rename (fname1, fname))
  666.                   {
  667.                   status_line ("!Mail Packet '%s' cannot be renamed", fname1);
  668.                   }
  669.                else
  670.                   {
  671.                   status_line ("!Mail Packet renamed to '%s'", fname);
  672.                   }
  673.                return (1);
  674.                }
  675.             }
  676.          got_packet = 1;
  677.          }
  678.       called_zone = remote_zone;
  679.       called_net = remote_net;
  680.       called_node = remote_node;
  681.       got_mail = got_packet;
  682.  
  683.       done = 0;
  684.       /* Now receive the files if possible */
  685.       status_line (" Inbound file attaches");
  686.       CLEAR_INBOUND ();
  687.       do
  688.          {
  689.          if ((i = try_sealink ()) == 0)
  690.             {
  691.             if (!recvmdm7 (fname))
  692.                {
  693.                done = 1;
  694.                }
  695.             else
  696.                {
  697.                if (!receive_file (CurrentNetFiles, NULL, 'T'))
  698.                   {
  699.                   if (locate_y > 1 && !(fullscreen && un_attended))
  700.                      gotoxy (0, locate_y - 1);
  701.                   done = 1;
  702.                   }
  703.                else
  704.                   {
  705.                   got_mail = 1;
  706.                   }
  707.                }
  708.             }
  709.          else if (i == 1)
  710.             {
  711.             if (!receive_file (CurrentNetFiles, NULL, 'F'))
  712.                {
  713.                if (locate_y > 1 && !(fullscreen && un_attended))
  714.                   gotoxy (0, locate_y - 1);
  715.                done = 1;
  716.                }
  717.             else
  718.                {
  719.                got_mail = 1;
  720.                }
  721.             }
  722.          else
  723.             {
  724.             done = 1;
  725.             }
  726.          } while (!done && CARRIER);
  727.       }
  728.  
  729.    status_line (" End of inbound file attaches");
  730.    CLEAR_INBOUND ();
  731.    return (0);
  732. }
  733.  
  734. static int FTSC_callback (sptr)
  735. char *sptr;
  736. {
  737.    int j;
  738.    char p;
  739.  
  740.    j = xfermdm7 (sptr);
  741.    p = 'T';
  742.    if (!j)
  743.       {
  744.       net_problems = 1;
  745.       return FALSE;
  746.       }
  747.    else if (j == 2)
  748.       p = 'F';
  749.  
  750.    net_problems = send_file (sptr, p);
  751.    if ((net_problems == TSYNC) || !net_problems)
  752.       {
  753.       net_problems = 1;
  754.       return FALSE;
  755.       }
  756.    return TRUE;
  757. }
  758.